﻿// Unity帮助类     
// 功能： 提供程序用户常用功能集。

using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;


namespace MotionFramework.UIKit
{
    public class UnityHelper
    {
        //是否是第一次加载游戏,默认是
        public static bool isFirstLoad = true;
               
        /// <summary>
        /// 清理内存(一般在切换场景的时候调用)
        /// </summary>
        public static void ClearMemory()
        {
            Resources.UnloadUnusedAssets();
            GC.Collect();
        }

        /// <summary>
        /// 查找子对象
        /// </summary>
        public static Transform FindTheChild(GameObject gameObject, string n)
        {
            return Prefab.Find(gameObject.transform, n);
        }

        /// <summary>
        /// 查找子对象
        /// </summary>
        public static Transform FindTheChild(Transform transform, string n)
        {
            return Prefab.Find(transform, n);
        }

        /// <summary>
        /// 给子物体添加父对象
        /// </summary>
        public static void AddChildToParent(Transform transform, Transform transformChild)
        {
            transformChild.SetParent(transform, false);
            transformChild.localPosition = Vector3.zero;
            transformChild.localScale = Vector3.one;
            transformChild.localEulerAngles = Vector3.zero;
        }

    }//Class_end
}
